<div class="b-pagename"><h1>Gift details</h1></div>

<div class="p-view">
	<div class="image">
		<div class="l-arrow">
			<a href="javascript:void(0)" ></a>
		</div>
		<div class="preview">
			<ul>
				<?php foreach ($images as $image) : ?>
				<li>
					<a href="javascript:void(0)"><img src="<?=Application::resources()?>storage/products/<?=$product['id']?>/2-<?=$image['name']?>" /></a>
				</li>
				<?php endforeach ?>
			</ul>
			<div style="clear:both"></div>
		</div>
		<div class="r-arrow">
			<a href="javascript:void(0)" ></a>
		</div>
	</div>
	<div class="details">
		<h1 class="name"><?=$product['name']?></h1>
		<ul>
			<li>
				<span class="label">State: </span>
				<?php if ($product['state'] == Product_Model::STATE_AVAILABLE) : ?>
				<span class="av"><?=$product['state']?></span>
				<?php elseif ($product['state'] == Product_Model::STATE_GIVEN) : ?>
				<span class="gvn"><?=$product['state']?></span>
				<?php elseif ($product['state'] == Product_Model::STATE_UNKNOWN) : ?>
				<span class="unk"><?=$product['state']?></span>
				<?php endif; ?>
			</li>
			<li>
				<span class="label">User: </span>
				<span><?=$owner['name']?></span>
			</li>
			<li>
				<span class="label">Phone: </span>
				<span><?=$owner['phone']?></span>
			</li>
		</ul>
		<div class="comment">
			<h1>User comment:</h1>
			<?=$product['comment']?>
		</div>
	</div>
	<div style="clear:both"></div>
	<div class="comments">
		<h1>Commentarii</h1>
		<ul>
		<?php foreach ($comments as $comment) : ?>
			<li>
				<div class="head">
					Posted by: <span><?=$comment['user_name']?></span> on 
					<?=Calendar::format('D, d M Y H:i:s', $comment['creation_time'])?>
				</div>
				<div class="content"><?=$comment['comment']?></div>
			</li>
		<?php endforeach ?>
		</ul>
		<?php if (Security_Manager::has_role(Security_Manager::DEFAULT_VISITOR_ROLE)) : ?>
		<form action="<?=Application::url()?>products/do_add_comment" method="POST" class="b-form">
			<fieldset>
				<legend>Add comment</legend>
				<?=form2_textarea(array(
						'name' => 'comment',
						'value' => set_value('comment'))); ?>
				<?=form2_submit('submit', 'Add'); ?>
			</fieldset>
			<input type="hidden" name="id" value="<?=$product['id']?>" />
		</form>
		<?php endif; ?>
	</div>
</div>